/* 
 * File:   CostCutting.c
 * Author: camenesesg
 *
 * Created on August 26, 2013, 7:54 PM
 */

#include <stdio.h>
#include <stdlib.h>

/*
 * 
 */
int main() {
#ifndef ONLINE_JUDGE
    FILE * FILE_NAME = freopen("inPalindromes.txt", "rt", stdin);
    int TIME = clock();
#endif
	int K, N, M, i, X, Y, xx, yy;
	scanf("%d", &K);
	while(K != 0) {
		scanf("%d %d", &N, &M);
		for(i = 0; i < K; i++) {
			scanf("%d %d", &X, &Y);
			xx = X - N;
			yy = Y - M;
			if (xx > 0 && yy > 0) {
				printf("NE\n");
			} else if (xx > 0 && yy < 0) {
				printf("SE\n");
			} else if (xx < 0 && yy > 0) {
				printf("NO\n");
			} else if (xx < 0 && yy < 0) {
				printf("SO\n");
			} else {
				printf("divisa\n");
			}
		}
		scanf("%d", &K);
	}
#ifndef ONLINE_JUDGE
    printf("%f\n", ((float) (clock() - TIME)));
    fclose(FILE_NAME);
#endif
    return (EXIT_SUCCESS);
}